import mysql.connector
from ttzScrapyProject.constants import MysqlConstant

db = None
cursor = None
class MysqlDao:

    def __init__(self):
        config = MysqlConstant.MYSQL_CONFIG
        self.db = mysql.connector.connect(
            host=config["host"],
            user=config["user"],
            password=config["password"],
            database=config["database"],

            port=config["port"]
        )
        self.cursor = self.db.cursor()

    def getCursor(self):
        return self.cursor

    def getDB(self):
        return self.db

